/// <summary>
/// 打开命令
/// </summary>
// 3. ConcreteCommand
public class LightOnCommand : ICommand
{
  private readonly Light _light;
  private bool _wasOn; // 用于撤销

  public LightOnCommand(Light light) => _light = light;

  public void Execute()
  {
    _wasOn = false; // 假设执行前是关的
    _light.TurnOn();
  }

  public void Undo() => _light.TurnOff();
}